package com.csyaonie.android;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.csyaonie.android.service.MyService;

public class ServiceActivity extends AppCompatActivity {

    private Button servicebt1;
    private Button servicebt2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_service);
        servicebt1=findViewById(R.id.servicebt1);
        servicebt2=findViewById(R.id.servicebt2);

        servicebt1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(ServiceActivity.this,MyService.class);
                startService(intent);
            }
        });

        servicebt2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(ServiceActivity.this,MyService.class);


                stopService(intent);
            }
        });
    }
}